from django.contrib import admin
from django.urls import path, include
from web.views import account, user, project, manage, wiki, file


urlpatterns = [

    path("", account.root, name='root'),
    path("send/sms/", account.send_code, name='send_code'),
    path("image/code/", account.img_code, name='img_code'),
    path("index/", account.index, name='index'),
    path("register/", account.register, name='register'),
    path("login/", account.Login.as_view(), name='login'),
    path("user/login/", account.user_login, name='user_login'),

    path("logout/", account.logout, name='logout'),
    path("user/list/", user.user_list, name='user_list'),

    # 项目列表
    path("project/list/", project.ProjectList.as_view(), name='project_list'),
    path("project/star/<project_type>/<project_id>/", project.project_star, name='project_star'),
    path("project/unstar/<project_type>/<project_id>/", project.project_unstar, name='project_unstar'),

    # 项目管理
    path("manage/<project_id>/", include([
        path("dashboard", manage.dashboard, name='dashboard'),
        path("issues", manage.issues, name='issues'),
        path("statistics", manage.statistics, name='statistics'),

        path("file/", file.File.as_view(), name='file'),
        path("file/delete/", file.file_delete, name='file_delete'),
        path("file/post/", file.file_post, name='file_post'),
        path("cos/credential/", file.cos_credential, name='cos_credential'),
        # path("file", file.file_post, name='file'),
        # path("file", file.file_download, name='file'),

        path("wiki", wiki.Wiki.as_view(), name='wiki'),
        path("wiki/add", wiki.WikiAdd.as_view(), name='wiki_add'),
        path("wiki/delete/<wiki_id>/", wiki.wiki_delete, name='wiki_delete'),
        path("wiki/edit/<wiki_id>/", wiki.wiki_edit, name='wiki_edit'),
        path("wiki_catalog", wiki.WikiCatalog.as_view(), name='wiki_catalog'),
        path("wiki_upload", wiki.wiki_upload, name='wiki_upload'),
        path("setting", manage.setting, name='setting'),
    ], None)),

    # path("manage/<project_id>/dashboard", project.manage_dashboard, name='manage_dashboard'),
    # path("manage/<project_id>/issues", project.manage_issues, name='manage_issues'),
    # path("manage/<project_id>/statistics", project.manage_statistics, name='manage_statistics'),
    # path("manage/<project_id>/file", project.manage_file, name='manage_file'),
    # path("manage/<project_id>/wiki", project.manage_wiki, name='manage_wiki'),
    # path("manage/<project_id>/setting", project.manage_setting, name='manage_setting'),

]
